package com.coustemview.qianfeng.huaqiangbeistore.model;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by mingma on 2016/9/1.
 */
public class Oversear_specialcation_Bean {

    /**
     * code : 200
     * msg : 操作成功
     * data : [{"keyPropId":20000,"keyProp":"品牌","valueId":30111,"value":"Apple/苹果"},{"keyPropId":22988,"keyProp":"Apple型号","valueId":1300017298,"value":"iPhone 6s Plus HK"},{"keyPropId":30606,"keyProp":"上市时间","valueId":1300016335,"value":"2015年"},{"keyPropId":13801175,"keyProp":"主屏分辨率","valueId":1300007609,"value":"1920×1080像素"},{"keyPropId":10000,"keyProp":"外观样式","valueId":10000,"value":"直板"},{"keyPropId":10003,"keyProp":"屏幕颜色","valueId":20309,"value":"1600万"},{"keyPropId":1627099,"keyProp":"主屏尺寸","valueId":300005709,"value":"5.5英寸"},{"keyPropId":20573,"keyProp":"操作系统","valueId":1300017301,"value":"iOS 9"},{"keyPropId":20710,"keyProp":"是否智能手机","valueId":21958,"value":"智能手机"},{"keyPropId":1200000809,"keyProp":"前摄像头","valueId":6611079,"value":"500万像素"},{"keyPropId":10002,"keyProp":"摄像头","valueId":3269331,"value":"1200万"},{"keyPropId":9453082,"keyProp":"触摸屏","valueId":89595245,"value":"电容式触摸屏"},{"keyPropId":12304035,"keyProp":"机身内存ROM","valueId":1300015839,"value":"16G/64G/128G"},{"keyPropId":20571,"keyProp":"储存功能","valueId":28960,"value":"不支持存储卡"},{"keyPropId":20574,"keyProp":"高级功能","valueId":1300017294,"value":"3D touch"},{"keyPropId":1200001723,"keyProp":"网络制式","valueId":1300014037,"value":"联通3G(WCDMA)/联通4G（TD-LTE）/移动4G（TD-LTE）/联通4G（FDD-LTE）/联通2G/移动2G(GSM)/移动3G(TD-SCDMA)"},{"keyPropId":1200001721,"keyProp":"CPU核数","valueId":1300007718,"value":"双核"},{"keyPropId":1200001510,"keyProp":"电池容量","valueId":1300017425,"value":"2750mAh"},{"keyPropId":1200001432,"keyProp":"SIM卡类型","valueId":1300011411,"value":"Nano SIM（小卡）"},{"keyPropId":34375,"keyProp":"厚度","valueId":119650022,"value":"超薄(小于9mm)"},{"keyPropId":1200001727,"keyProp":"CPU型号","valueId":1300017300,"value":"苹果 A9+M9协处理器"}]
     */

    private int code;
    private String msg;
    /**
     * keyPropId : 20000
     * keyProp : 品牌
     * valueId : 30111
     * value : Apple/苹果
     */

    private List<DataBean> data;

    public static Oversear_specialcation_Bean objectFromData(String str) {

        return new Gson().fromJson(str, Oversear_specialcation_Bean.class);
    }

    public static Oversear_specialcation_Bean objectFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);

            return new Gson().fromJson(jsonObject.getString(str), Oversear_specialcation_Bean.class);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        return null;
    }

    public static List<Oversear_specialcation_Bean> arrayOversear_specialcation_BeanFromData(String str) {

        Type listType = new TypeToken<ArrayList<Oversear_specialcation_Bean>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public static List<Oversear_specialcation_Bean> arrayOversear_specialcation_BeanFromData(String str, String key) {

        try {
            JSONObject jsonObject = new JSONObject(str);
            Type listType = new TypeToken<ArrayList<Oversear_specialcation_Bean>>() {
            }.getType();

            return new Gson().fromJson(jsonObject.getString(str), listType);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return new ArrayList();


    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public List<DataBean> getData() {
        return data;
    }

    public void setData(List<DataBean> data) {
        this.data = data;
    }

    public static class DataBean {
        private int keyPropId;
        private String keyProp;
        private int valueId;
        private String value;

        public static DataBean objectFromData(String str) {

            return new Gson().fromJson(str, DataBean.class);
        }

        public static DataBean objectFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);

                return new Gson().fromJson(jsonObject.getString(str), DataBean.class);
            } catch (JSONException e) {
                e.printStackTrace();
            }

            return null;
        }

        public static List<DataBean> arrayDataBeanFromData(String str) {

            Type listType = new TypeToken<ArrayList<DataBean>>() {
            }.getType();

            return new Gson().fromJson(str, listType);
        }

        public static List<DataBean> arrayDataBeanFromData(String str, String key) {

            try {
                JSONObject jsonObject = new JSONObject(str);
                Type listType = new TypeToken<ArrayList<DataBean>>() {
                }.getType();

                return new Gson().fromJson(jsonObject.getString(str), listType);

            } catch (JSONException e) {
                e.printStackTrace();
            }

            return new ArrayList();


        }

        public int getKeyPropId() {
            return keyPropId;
        }

        public void setKeyPropId(int keyPropId) {
            this.keyPropId = keyPropId;
        }

        public String getKeyProp() {
            return keyProp;
        }

        public void setKeyProp(String keyProp) {
            this.keyProp = keyProp;
        }

        public int getValueId() {
            return valueId;
        }

        public void setValueId(int valueId) {
            this.valueId = valueId;
        }

        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }
    }
}
